package sapling.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import sapling.model.Admin;
import sapling.model.OutboundOrder;
import sapling.model.Tree;

import java.util.List;

/**
 * Created by Administrator on 2017/6/27.
 */
public interface OutboundOrderDao extends JpaRepository<OutboundOrder, Long> {
    List<OutboundOrder> findByStatus(int status);

    @Query(value = "SELECT count(id) from tree where outbound_order_id in (SELECT id from outbound_order where sales_state=0) and price=0  GROUP BY outbound_order_id",nativeQuery = true)
    int findCompany();
}
